<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue.js + axios + api</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>

    <script src="https://cdn.staticfile.org/vue/2.7.0/vue.min.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>

</head>
<body>
<h1>显示列表</h1>
<div id="vue_user">
    <!--        {{info}}-->
    <h1>user表</h1>
    <table class="table">
        <caption>user表</caption>
        <thead>
        <tr>
            <th>Id</th>
            <th>姓名</th>
            <th>密码</th>
            <th>请求地址</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="u in info">
            <td>{{u._links.self.href.split("/")[4]}}</td>
            <td>{{u.username}}</td>
            <td>{{u.password}}</td>
            <td>{{u._links.self.href.split("/")[2]}}</td>
        </tr>
        </tbody>
    </table>
</div>
<script type="text/javascript">
    var vm = new Vue({
        el: '#vue_user',
        data: {},
        methods: {},
        data() {
            return {
                info: null
            }
        },
        mounted() {
            axios
                .get('/hi')
                .then(response => (this.info = response.data._embedded.customers))
                .catch(function (error) { // 请求失败处理
                    console.log(error);
                });
        }
    })

</script>
</body>
</html>